package com.eqdd.yiqidian.base.loading.waitdialog;


import android.content.Context;

import com.eqdd.yiqidian.R;
import com.eqdd.yiqidian.base.loading.INetLoadingView;

import io.reactivex.android.schedulers.AndroidSchedulers;


public class DialogHelper implements INetLoadingView {


	private WaitDialog dialog;

	public DialogHelper(Context context) {
		dialog = null;
		try {
			dialog = new WaitDialog(context, R.style.CDialog);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}


	@Override
	public void showLoading() {

		dialog.show();
	}

	@Override
	public void showLoading(final String msg) {
		AndroidSchedulers.mainThread().createWorker().schedule(() -> {
			dialog.setMessage(msg);
			dialog.show();
		});
	}

	@Override
	public void hideLoading(String msg) {
		dialog.dismiss();
	}

	@Override
	public void hideLoading() {
		dialog.dismiss();
	}

}
